namespace ExcelTemplateEngine.Infrastructure.DependencyInjection
{
    public interface IServiceContainer
    {
        /// <summary>
        /// 注册单例服务
        /// </summary>
        void RegisterSingleton<TInterface, TImplementation>()
            where TImplementation : class, TInterface;
            
        /// <summary>
        /// 注册单例服务实例
        /// </summary>
        void RegisterSingleton<TInterface>(TInterface instance);
        
        /// <summary>
        /// 注册瞬态服务
        /// </summary>
        void RegisterTransient<TInterface, TImplementation>()
            where TImplementation : class, TInterface;
            
        /// <summary>
        /// 获取服务
        /// </summary>
        T GetService<T>();
        
        /// <summary>
        /// 尝试获取服务
        /// </summary>
        bool TryGetService<T>(out T? service);
        
        /// <summary>
        /// 检查服务是否已注册
        /// </summary>
        bool IsRegistered<T>();
    }
    
    public enum ServiceLifetime
    {
        Singleton,
        Transient
    }
}